import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkProductVO, ParkProductForm, ParkProductQuery } from '@/api/park/parkProduct/types';

/**
 * 查询产品列表
 * @param query
 * @returns {*}
 */

export const listParkProduct = (query?: ParkProductQuery): AxiosPromise<ParkProductVO[]> => {
  return request({
    url: '/park/parkProduct/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品详细
 * @param productId
 */
export const getParkProduct = (productId: string | number): AxiosPromise<ParkProductVO> => {
  return request({
    url: '/park/parkProduct/' + productId,
    method: 'get'
  });
};

/**
 * 新增产品
 * @param data
 */
export const addParkProduct = (data: ParkProductForm) => {
  return request({
    url: '/park/parkProduct',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品
 * @param data
 */
export const updateParkProduct = (data: ParkProductForm) => {
  return request({
    url: '/park/parkProduct',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品
 * @param productId
 */
export const delParkProduct = (productId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkProduct/' + productId,
    method: 'delete'
  });
};
